// ----------------------------------
// RSDK Project: Sonic 1/Sonic 2
// Script Description: Bridge End Object
// Script Author: Christan Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

//-------Aliases-------//
private alias 45 : TYPE_BRIDGEEND

// Function declarations
reserve function BridgeEnd_DebugDraw
reserve function BridgeEnd_DebugSpawn

// Static Values

// Tables

function BridgeEnd_DebugDraw
	temp0 = object.direction
	temp0 &= 1
	DrawSprite(temp0)
end function


function BridgeEnd_DebugSpawn
	CreateTempObject(TypeName[Bridge End], 0, object.xpos, object.ypos)
	object[tempObjectPos].drawOrder = 4
	object[tempObjectPos].propertyValue = object.direction
	object[tempObjectPos].propertyValue &= 1
end function


event ObjectDraw
	DrawSprite(object.propertyValue)
end event


event ObjectStartup
	LoadSpriteSheet("GHZ/Objects.gif")
	SpriteFrame(-16, -8, 32, 16, 18, 1)
	SpriteFrame(-16, -8, 32, 16, 51, 1)
	arrayPos0 = 32
	while arrayPos0 < 0x420
		if object[arrayPos0].type == TypeName[Bridge End]
			object[arrayPos0].drawOrder = 4
		end if
		arrayPos0++
	loop
	SetTableValue(TypeName[Bridge End], DebugMode_ObjCount, DebugMode_TypesTable)
	SetTableValue(BridgeEnd_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
	SetTableValue(BridgeEnd_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
	DebugMode_ObjCount++
end event

event RSDKDraw
	DrawSprite(0)
end event

event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-16, -16, 32, 32, 1, 143)
end event
